package com.xxx.store.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * TODO
 *
 * @ClassName
 * @Author FGH
 * @Date 2023/3/8 2:25 下午
 **/
@Configuration
public class ResourceConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        String path = System.getProperty("user.dir");
        //     file:/project/images
        String target = "file:"+path + "/upload/";
        registry.addResourceHandler("/upload/**").addResourceLocations(target);
    }
}
